//
//  LoginViewController.m
//  02_Work
//
//  Created by dllo on 16/7/15.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "LoginViewController.h"

@interface LoginViewController () <UITextFieldDelegate>
@property (nonatomic, strong) UIView *textFieldView;
@property (nonatomic, strong) UIView *clearView;


@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor redColor];
    UIImageView *backGroundImageView = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    backGroundImageView.backgroundColor = [UIColor redColor];
    UIImage *image = [UIImage imageNamed:@"welcome_2"];
    [backGroundImageView setImage:image];
    [self.view addSubview:backGroundImageView];
    
    self.clearView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.clearView.backgroundColor = [UIColor clearColor];
    self.clearView.alpha = 0.8;
    [self.view addSubview:self.clearView];
    
    
    UIImageView *logoView = [[UIImageView alloc] initWithFrame:CGRectMake(backGroundImageView.frame.size.width / 2 - 60, 100, 120, 200)];
    UIImage *logoImage = [UIImage imageNamed:@"logo_lagou"];
    [logoView setImage:logoImage];
    [self.clearView addSubview:logoView];
    
    self.textFieldView = [[UIView alloc] initWithFrame:CGRectMake(10, 350, backGroundImageView.frame.size.width - 20, 82)];
    self.textFieldView.layer.cornerRadius = 10;
    
    [self.clearView addSubview:self.textFieldView];
    
    UITextField *phoneTextField = [[UITextField alloc] initWithFrame:CGRectMake(40, 0, self.textFieldView.frame.size.width - 40, 40)];
    phoneTextField.backgroundColor = [UIColor colorWithRed:57.0 / 255 green:55.0 / 255 blue:55.0 / 255 alpha:0.8];
    phoneTextField.delegate = self;
    phoneTextField.placeholder = @"  请输入手机号";
    [phoneTextField setValue:[UIColor grayColor] forKeyPath:@"_placeholderLabel.textColor"];
    phoneTextField.delegate = self;
    [self.textFieldView addSubview:phoneTextField];
    UITextField *checkTextField = [[UITextField alloc] initWithFrame:CGRectMake(40, 42, self.textFieldView.frame.size.width - 40, 40)];
    checkTextField.placeholder = @"  请输入验证码";
    [checkTextField setValue:[UIColor grayColor] forKeyPath:@"_placeholderLabel.textColor"];
    checkTextField.backgroundColor = [UIColor colorWithRed:57.0 / 255 green:55.0 / 255 blue:55.0 / 255 alpha:0.8];
    checkTextField.delegate = self;
    [self.textFieldView addSubview:checkTextField];
    
    UIButton *checkButton = [UIButton buttonWithType:UIButtonTypeSystem];
    checkButton.frame = CGRectMake(self.textFieldView.frame.size.width - 100, 42, 100, 40);
    [checkButton setTitle:@"获取验证码" forState:UIControlStateNormal];
    [self.textFieldView addSubview:checkButton];
    [checkButton setTitleColor:[UIColor colorWithRed:61.0 / 255 green:160.0 / 255 blue:115.0 / 255 alpha:0.8] forState:UIControlStateNormal];
    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(self.textFieldView.frame.size.width - 110, 49, 2, 26)];
    lineView.backgroundColor = [UIColor grayColor];
    [self.textFieldView addSubview:lineView];
    
    
    UIImageView *phoneImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
    phoneImageView.backgroundColor = [UIColor blackColor];
    UIImage *phoneImage = [UIImage imageNamed:@"phone"];
    [phoneImageView setImage:phoneImage];
    [self.textFieldView addSubview:phoneImageView];
    
    UIImageView *checkImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 42, 40, 40)];
    checkImageView.backgroundColor = [UIColor blackColor];
    UIImage *checkImage = [UIImage imageNamed:@"check"];
    [checkImageView setImage:checkImage];
    [self.textFieldView addSubview:checkImageView];
    
    UILabel *regLabel = [[UILabel alloc] initWithFrame:CGRectMake(70, 440, self.clearView.frame.size.width - 200, 40)];
    regLabel.text = @"注册代表你已同意";
    regLabel.textColor = [UIColor whiteColor];
    regLabel.font = [UIFont systemFontOfSize:17];
    [self.clearView addSubview:regLabel];
    
    UIButton *delegateButton = [UIButton buttonWithType:UIButtonTypeSystem];
    delegateButton.frame = CGRectMake(self.clearView.frame.size.width - 255, 440, 200, 40);
    [delegateButton setTitle:@"拉勾用户协议" forState:UIControlStateNormal];
    delegateButton.titleLabel.font = [UIFont systemFontOfSize:17];
    [delegateButton setTitleColor:[UIColor colorWithRed:61.0 / 255 green:160.0 / 255 blue:115.0 / 255 alpha:0.8] forState:UIControlStateNormal];
    [self.clearView addSubview:delegateButton];
    
    
    UIButton *regButton = [UIButton buttonWithType:UIButtonTypeSystem];
    regButton.frame = CGRectMake(10, 500, backGroundImageView.frame.size.width - 20 , 40);
    regButton.backgroundColor = [UIColor colorWithRed:61.0 / 255 green:160.0 / 255 blue:115.0 / 255 alpha:0.9];
    [regButton setTitle:@"注册" forState:UIControlStateNormal];
    [regButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    regButton.layer.cornerRadius = 5;
    [self.clearView addSubview:regButton];
    
    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeSystem];
    backButton.frame = CGRectMake(10, 560, backGroundImageView.frame.size.width - 20 , 40);
    backButton.backgroundColor = [UIColor colorWithRed:61.0 / 255 green:160.0 / 255 blue:115.0 / 255 alpha:0.4];
    [backButton setTitle:@"返回登录" forState:UIControlStateNormal];
    [backButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    backButton.layer.cornerRadius = 5;
    [backButton addTarget:self action:@selector(backClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.clearView addSubview:backButton];

    
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [textField endEditing:YES];
    return YES;
}

- (void)backClick:(UIButton *)button {
    [self dismissViewControllerAnimated:YES completion:nil];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
